//
//  COFollowListViewCell.swift
//  CocoProject
//
//  Created by Vill on 2023/11/10.
//

import UIKit

// 开始编辑
typealias avaterBlock = ()->Void

class COFollowListViewCell: UITableViewCell {
    
    var avaterBack:avaterBlock?
    
    @IBOutlet weak var iconImg: UIImageView!
    
    @IBOutlet weak var nameLbl: UILabel!
    
    static let reusedID = "COFollowListViewCell"
    public func cellWithTableView(_ tableView:UITableView) -> COFollowListViewCell{
        var cell:COFollowListViewCell! = tableView.dequeueReusableCell(withIdentifier: COFollowListViewCell.reusedID) as? COFollowListViewCell
        if cell == nil {
            cell = (Bundle.main.loadNibNamed("COFollowListViewCell", owner: nil, options: nil)?.first as! COFollowListViewCell)
        }
        return cell!
    }
    
    var model:HotListModel?{
        didSet {
            guard let model = model else {
                return
            }
            iconImg.sd_setUrlImage(model.profilePhoto, placeholder: KImaged("coco_icon_holder"))
            nameLbl.text = model.name
        }
    }

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        self.iconImg.contentMode = .scaleAspectFill
        self.iconImg.clipsAllCorners(radius: 25)
        self.iconImg.addTap { [weak self] ges in
            if self?.avaterBack != nil {
                self?.avaterBack!()
            }
        }
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        // Configure the view for the selected state
    }

}
